import 'babel-polyfill'

import React from 'react';
import ReactDOM from 'react-dom';

import { Router, Route, hashHistory } from 'react-router';

import { createStore ,applyMiddleware,compose} from 'redux';
import { Provider } from 'react-redux';
import createSagaMiddleware from 'redux-saga'

import {RootReducer} from './reducer';
import rootSaga from './saga'
import DevTools from './global/DevTools'

import routes from './modules/router/index'

import './common/style/normalize.less'
import './common/style/comm.less'

const sagaMiddleware = createSagaMiddleware()

//store
const finalCreateStore = compose(
    applyMiddleware(sagaMiddleware),
    DevTools.instrument()
)(createStore);

const store = finalCreateStore(RootReducer);

ReactDOM.render(
        <Provider store={store}>
           <div>
               <Router history={hashHistory} routes={routes}/>
               <DevTools />
           </div>
        </Provider>
    , document.getElementById('test'));

sagaMiddleware.run(rootSaga)
